<?php
class DashboardsController extends AppController {
    var $name = 'Dashboards';
    //var $uses = array('Entry');
    
    function admin_index() {
        $this->set('title_for_layout','Dashboard');
        
        

    }
    
    
    
    
    
    function admin_settings() {
        
        if(!empty($this->data)) :
            $data = array();
            foreach($this->data['Setting'] as $key => $item) :
                $data[] = array(
                    'Setting' => array(
                        'key' => $key,
                        'value' => $item,
                    )
                );
            endforeach;
            //$data = array('Setting' => $data);
            if($this->Setting->saveAll($data, array('validate' => false, 'atomic' => false))):
                
                $this->Session->write('Success',true);
                $this->Session->setFlash('Settings updated sucessfully');
                $this->redirect($this->referer());
                exit;
            endif;
        endif;
        
        $this->set('settings', $this->Setting->find('list', array('fields' => array('key', 'value', 'type'))));
    }
    
}
?>